﻿@{
    string pointId = ViewBag.pointId;
    string cdate = DateTimeHelper.FormatDate(DateTime.Now.Date);
    var currentUser = AuthHelper.GetSessionUser();
    var CurrentUserName = currentUser.Name;
}
<div class="module-container">
    <div class="search-panel">
        <form class="form-inline search-table">
            <div class="form-group">
                <input class="form-control w120px" name="name" type="text"
                       placeholder="请输入车牌号">
            </div>
            <div class="form-group">
                <select class="form-control uiselect uiselectsubmit" name="Station"
                        data-has-text-field="false" data-width="200">
                    @Html.EmptyOption("所有客运站")
                    @Html.StationCategoryOption()
                </select>
            </div>
            <div class="form-group">
                <select class="form-control uiselect uiselectsubmit" name="CheckStatus"
                        data-has-text-field="false" data-width="150">
                    @Html.EmptyOption("稽查状态")
                    @Html.CheckStatusCategoryOption()
                </select>
            </div>
            <div class="form-group">
                <select id="Point" class="form-control uiselect uiselectsubmit" name="Point"
                        data-has-text-field="false" data-width="120">
                    @Html.CheckPointsCategoryOption(pointId)
                </select>
            </div>
            <div class="form-group">
                <select id="CreateId" class="form-control uiselect uiselectsubmit" name="CreateId"
                        data-has-text-field="true"
                        data-width="100"></select>
                @*<input class="form-control w120px" name="createname" type="text" value="@CurrentUserName"
                       placeholder="请输入操作人">*@
            </div>
            <div class="form-group">
                <div class="input-group date w165px uidate">
                    <input class="form-control" name="startDate" type="text" value="@cdate" placeholder="请选择开始日期">
                    <span class="input-group-addon">
                        <i class="glyphicon glyphicon-th"></i>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group date w165px uidate">
                    <input class="form-control" name="endDate" type="text" placeholder="请选择结束日期">
                    <span class="input-group-addon">
                        <i class="glyphicon glyphicon-th"></i>
                    </span>
                </div>
            </div>

            <button class="btn btn-primary" type="submit">
                <i class="fa fa-search"></i> 查询
            </button>
            
            <a id="emp_export" class="btn btn-default" data-url="@Url.Action("Export")">
                <i class="fa fa-share-square-o"></i> 导出
            </a>
            @*总数：<span id="sys_totalcount"></span>*@
        </form>
    </div>
    <div class="uitable" data-url="@Url.Action("Grid",new { Point = pointId,startDate=cdate})">
        @Html.Action("Grid", new { Point = pointId, startDate = cdate })
    </div>
</div>
<script>

    $('#emp_export').on('click', function () {
        var url = $(this).data('url') + '?' + $.param(fx.serializeForm($('.search-table')));
        window.location.href = url;
    });


    $("#Point").on("change", function (e) {
        showPointID();
    });
    function showPointID()
    {
        var PointID = $("#Point").val();
        if (PointID == null || PointID == undefined || PointID.replace(/(^\s*)|(\s*$)/g, "").length == 0) {
            $('#CreateId').empty();
            $('#CreateId').append($('<option></option>').val('0').text('请选择稽查点'));
        }
        else {
            $.getJSON('@Url.Action("GetCheckPointUserInfo", "SystemReg")', { PointID: PointID }, function (data) {
                $('#CreateId').empty();
                $('#CreateId').append($('<option></option>').val('0').text('全部'));
                $.each(data, function (i, item) {
                    $('#CreateId').append($('<option></option>').val(item.Value).text(item.Text));
                });
            });
        }
    }
    showPointID();
</script>